package com.gc.server.vo.down;

import com.alibaba.excel.annotation.ExcelProperty;
import com.gc.server.vo.ImgOrderStatusEnum;
import com.gc.server.vo.ImgOrderVo;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class ImgOrderDown {

    @ExcelProperty("ID")
    private Long id;

    @ExcelProperty("店员名")
    private String name;

    @ExcelProperty("店员编号")
    private String code;

    @ExcelProperty("上级")
    private String top;


    @ExcelProperty("客户名")
    private String cusName;

    @ExcelProperty("客户编号")
    private String cusCode;

    @ExcelProperty("药店名")
    private String shopName;

    @ExcelProperty("药店区域")
    private String address;

    @ExcelProperty("连锁名")
    private String linkName;


    @ExcelProperty("积分")
    private BigDecimal point;

    @ExcelProperty("兑费")
    private BigDecimal money;

    @ExcelProperty("价值")
    private BigDecimal price;

    @ExcelProperty("手机号")
    private String mobile;

    @ExcelProperty("时间")
    private Date date;

    @ExcelProperty("状态")
    private String status;

    @ExcelProperty("产品")
    private String remark;

    @ExcelProperty("数量")
    private Integer quantity;

    @ExcelProperty("备注")
    private String info;


    public ImgOrderDown() {

    }

    public  ImgOrderDown(ImgOrderVo orderVo) {
        this.name = orderVo.getUser().getName();
        this.code = orderVo.getUser().getCode();
        this.shopName = orderVo.getUser().getShopName();
        this.id = orderVo.getImgOrder().getId();
        if(orderVo.getCus()!=null){
            this.cusName = orderVo.getCus().getName();
            this.cusCode = orderVo.getCus().getCode();
        }
        if(orderVo.getTop()!=null){
            this.top = orderVo.getTop().getCode()+orderVo.getTop().getName();
        }
        this.quantity = orderVo.getImgOrder().getQuantity();
        this.linkName = orderVo.getUser().getLinkName();
//        this.address = orderVo.getUser().getCity()+orderVo.getUser().getProvince()+orderVo.getUser().getCounty()+orderVo.getUser().getAddress();
        this.address = orderVo.getUser().getCity();
        this.price = orderVo.getImgOrder().getPrice();
        this.point = orderVo.getImgOrder().getPoint();
        this.money = orderVo.getImgOrder().getMoney();
        this.mobile = orderVo.getImgOrder().getMobile();
        this.remark = orderVo.getImgOrder().getRemark();
        this.info = orderVo.getImgOrder().getInfo();
        this.status = ImgOrderStatusEnum.indexOf(orderVo.getImgOrder().getStatus());
        this.date = orderVo.getImgOrder().getDate();
        System.out.println(this.date);
    }
}
